﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoleUserList.aspx.cs" Inherits="DBA.Web.SystemManage.Permissions.RoleUserList" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="../../Styles/css/newCore.css" rel="stylesheet" type="text/css"/>
<link href="../../Styles/azure/style.css" rel="stylesheet" type="text/css"/>

<%--<link href="../../Styles/css/print.css" rel="stylesheet" type="text/css" media="print"/>--%>

<!--[if IE]>
<link href="themes/css/ieHack.css" rel="stylesheet" type="text/css" media="screen"/>
<![endif]-->
    <script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.bgiframe.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.core.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.ui.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.resize.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.sortDrag.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.cssTable.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.stable.js" type="text/javascript"></script>
<script src="../../Scripts/dwz.pagination.js" type="text/javascript"></script>
    <script src="../../Scripts/dwz.drag.js" type="text/javascript"></script>
    <script src="../../Scripts/dwz.barDrag.js" type="text/javascript"></script>
    <link href="../../Scripts/ZTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/lhgdialog/lhgdialog.js" type="text/javascript"></script>
    <script src="../../Scripts/ZTree/js/jquery.ztree.all-3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/ZTree/js/jquery.ztree.core-3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/ZTree/js/jquery.ztree.excheck-3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/ZTree/js/jquery.ztree.exedit-3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Public.js" type="text/javascript"></script>
<style type="text/css">
	ul.rightTools {float:right; display:block;}
	ul.rightTools li{float:left; display:block; margin-left:5px}
</style>
    <script type="text/javascript">
        function addRoleUser() {
            var id = $("#hidRoleID").val();
            if (id == "0" || id == "") {
                alert("请选择分类下面具体的角色后再添加用户");
                return;
            }
            Public.ShowWindow('选择教师', "../SystemManage/Permissions/RoleUserAdd.aspx?r=" + Math.random() + "&RoleID=" + id, 900, 560);
        }

        function modifyRole(id) {
            var url = '/RoleUserManage/RoleAdd.aspx?r=' + Math.random() + "&id=" + id;
            Public.ShowWindow("修改系统角色", url, 700, 250);
        }



        //全选
        function SetAllCheck(obj) {
            if (obj.checked == true) {//选中状态
                $(":checkbox", "#tableBody").each(function () {
                    if ($(this).attr("checked") == false) {
                        $(this).attr("checked", true);
                        $("#hidUserID").val($("#hidUserID").val() + "," + $(this).attr("value"));
                        $("#hidUserName").val($("#hidUserName").val() + "," + $(this).attr("title"));

                    }

                }
                );
            }
            else {//取消状态
                $(":checkbox", "#tableBody").each(function () {
                    if ($(this).attr("checked") == true) {
                        $(this).attr("checked", false);
                        $("#hidUserID").val($("#hidUserID").val().replace("," + $(this).attr("value"), ""));
                        $("#hidUserName").val($("#hidUserName").val().replace("," + $(this).attr("title"), ""));
                    }
                }
                );
            }

        }
        //单个项的选择
        function SetChildCheck(obj) {
            if (obj.checked == true) {
                $("#hidUserID").val($("#hidUserID").val() + "," + obj.value);
                $("#hidUserName").val($("#hidUserName").val() + "," + obj.title);
            }
            else {
                $("#hidUserID").val($("#hidUserID").val().replace("," + obj.value, ""));
                $("#hidUserName").val($("#hidUserName").val().replace("," + obj.title, ""));
            }

        }

        //tree
        var setting = {
            check: {
                enable: true,
                chkStyle: "radio",
                radioType: "all"
            },
            view: {
                dblClickExpand: false
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onCheck: onCheck
            }
        };



        function onCheck(e, treeId, treeNode) {
            if (treeNode.checked) {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			 nodes = zTree.getCheckedNodes(true);

                $("#hidRoleID").val(nodes[0].id);
                $("#hidRoleType").val(nodes[0].unitType);

                __doPostBack("lnkSearch", "");
            }
            else {
                //treeNode.checked = true;

            }

        }
        function initTable(_box) {
            var $p = $(_box || document);
            //tables
            $("table.table", $p).jTable();
            // css tables
            $('table.list', $p).cssTable();
        }

        //批量删除事件
        function deleteSelect() {
            var selectValue = $("#tableBody").getAllSelectedValue().join(",");
            if (selectValue != undefined && selectValue != '') {
                parent.alertMsg.confirm("是否删除选择的信息?", {
                    okCall: function () {
                        $("#hidDeleString").val(selectValue);
                        __doPostBack("lnkDelete", "");
                    }
                });
            } else {
                parent.alertMsg.info("请选择要删除要的数据");
            }
        }
        $(document).ready(function () {
            var zNodes = $.parseJSON($("#hidTreeData").val());
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        });
        $(function () {
            var iContentH = $(window).height() - $("#header").height() - 34;
            $("#dv_left").height(iContentH - 34).find("[layoutH]").layoutH();
            $("#jbsxBox").height(iContentH - 34).find("[layoutH]").layoutH();
            DWZ.init("/dwz.frag.xml");
            setTimeout("initTable()", 1);
//            $("#btnAddClassStudent").live("click", function () {
//                var id = $("#hidRoleID").val();
//                if (id == "0" || id == "1" || id == "2" || id == "") {
//                    alert("请选择分类下面具体的角色后再添加用户");
//                    return;
//                }
//                Public.ShowWindow("添加用户", "../SystemManage/RoleUserAdd.aspx?r=" + Math.random() + "&RoleGuid=" + id, 900, 560);
//            });
            $("#btn_Del").live("click", function () {
                var selectValue = $("#hidUserID").val();
                if (selectValue != undefined && selectValue != '') {
                    if (confirm("是否确认删除您选中的用户？")) {
                        Public.CallBack("lnkDelete", "");
                    }
                } else {
                    alert("请选择您要删除的用户!");
                }
            });
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
                initTable();
            });
        });
	</script>
</head>
<body style="background:#fff;">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<div class="pageHeader">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
      <div class="searchBar">
		<table class="searchContent">
			<tr>
				<td>
					用户名：<asp:TextBox ID="txtName" runat="server" style="width:100px;" CssClass="textInput"></asp:TextBox>
				</td>
			</tr>
		</table>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button  onclick="javascript:searchHandler();return false;">检索</button></div></div></li>
				<li style="display:none;"><a class="button" href="#" onclick="javascirpt:ddd();return false;"><span>高级检索</span></a></li>
			</ul>
		</div>
        <div style="display:none;">
<%--                    <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                    <ContentTemplate>
                    <asp:HiddenField ID="hdMaskMemberId" runat="server" />
                      <asp:LinkButton ID="linkBtnSearch" runat="server" onclick="linkBtnSearch_Click" ></asp:LinkButton>      
                      <asp:LinkButton ID="linkBtnMaskSearch" runat="server" onclick="linkBtnMaskSearch_Click" ></asp:LinkButton> 
                        <asp:HiddenField ID="hidDeleString" runat="server" />  
                      <asp:LinkButton ID="linkBtnDeleSelect" runat="server" onclick="linkBtnDeleSelect_Click" ></asp:LinkButton> 
                    </ContentTemplate>
                    </asp:UpdatePanel>--%>
                <asp:HiddenField ID="hidDeleString" runat="server" />  
                <asp:LinkButton ID="lnkSearch" runat="server" onclick="lnkSearch_Click"></asp:LinkButton>
                <asp:LinkButton ID="lnkDelete" runat="server" onclick="lnkDelete_Click"></asp:LinkButton>
         </div>
      </ContentTemplate>
    </asp:UpdatePanel>
       </div>     
	</div>
<div class="pageContent" style="padding:5px">
				<div id="dv_left" layoutH="100" style="float:left; display:block; overflow:auto; width:240px; border:solid 1px #CCC; line-height:21px; background:#fff">
				    <ul id="treeDemo" class="ztree" style="margin-top:0; width:90%; height: 300px;"></ul>
				</div>
				<div id="djbsxBox" class="unitBox" style="margin-left:246px;border:1px solid #ccc;" layoutH="100" >
                <div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="javascript:void(0);" onclick="javascript:addRoleUser();return false;"><span>添加:</span></a></li>
			<li><a class="delete" href="javascript:void(0);" onclick="javascript:deleteSelect();return false;"><span>批量删除</span></a></li>
		</ul>
	</div>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
	<table class="table" width="99%" layoutH="100" rel="jbsxBox">
		<thead>
			<tr>
				<th><input id="allChk" title="全选" onclick="javascript:$(this).SelectAll('tableBody');" value="all" type="checkbox" name="allChk"/></th>
				<th orderField="number" class="asc">姓名</th>
				<th  width="80" >性别</th>
				<th width="100">部门名称</th>
			</tr>
		</thead>
		<tbody id="tableBody">
        <asp:Repeater ID="replData" runat="server">
        <ItemTemplate>
			<tr target="RoleUserID" rel="<%# Eval("RoleUserID") %>">
                <td><INPUT id="Checkbox1" type="checkbox" name="chkson" onclick="javascript:$(this).singleSelected('allChk');" runat="server" class="checkbox" value='<%# Eval("RoleUserID") %>'></td>
                <td><%# Eval("EmployeeName")%></td>
                 <td><%# Eval("Sex").ToString().ToUpper() == "TRUE"?"男":"女"%></td>
                <td><%# Eval("DepartmentName")%></td>
			</tr>
        </ItemTemplate>
        </asp:Repeater>
            </tbody>
            </table>
                    <div style="display: none; float: left;">
                        <asp:HiddenField ID="hdSaveGuid" runat="server" />
                    </div>
                    <asp:HiddenField ID="hidRoleID" runat="server" />
                    <asp:HiddenField ID="hidUserID" runat="server" />
                    <asp:HiddenField ID="hidUserName" runat="server" />
                    <asp:HiddenField ID="hidRoleType" runat="server" />
                     <asp:HiddenField ID="hidTreeData" runat="server" />
    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" CustomInfoHTML="<div class='content'>第%CurrentPageIndex%/共%PageCount%页/共%RecordCount%条</div>"
                    FirstPageText="首页" LastPageText="末页" NextPageText="下页"
                    PrevPageText="上页" ShowCustomInfoSection="right" 
        ShowPageIndexBox="Never"  PageSize="10" Width="100%" CustomInfoClass="info"
        CssClass="paginator" onpagechanging="AspNetPager1_PageChanging" >
    </webdiyer:AspNetPager>
                    </ContentTemplate>
                    <Triggers>
                       <asp:AsyncPostBackTrigger ControlID="lnkSearch" />
                    </Triggers>
                    </asp:UpdatePanel>
				</div>
</div>
    </form>
</body>
</html>
